#define _CRT_SECURE_NO_WARNINGS 1

#include"gamemode.h"
#include<stdio.h>

void began()
{
	printf("**************************\n");
	printf("*                        *\n");
	printf("*      欢迎来到扫雷      *\n");
	printf("*       0:退出游戏       *\n");
	printf("*       1:开始游戏       *\n");
	printf("*         2:帮助         *\n");
	printf("*         3:关于         *\n");
	printf("*                        *\n");
	printf("**************************\n");
}

void Game()
{
	int chessboard[3][HIGH][WIDE] = {0};
	int key=1,dx,dy,choo,k;
	setboard(chessboard); k = 0;
	do
	{
		prboard(chessboard);
		printf("请输入操作（格式：x y t）\n");
		scanf("%d%d%d", &dx, &dy, &choo);
		dx--; dy--;
		switch (choo)
		{
		case 1:key = dig(chessboard, dx, dy); break;
		case 2:key = flag(chessboard, dx, dy, &k); break;
		case -1:test3(chessboard); break;
		default:
			printf("无此操作选项！\n如需退出游戏可输入0\n继续游戏请输入1\n");
			scanf("%d", &choo);
			if (choo == 0) return;
		}
	} while (key == 1);
}

main()
{
	int chance = 0;
	do
	{
		began();
		scanf("%d",&chance);
		switch(chance)
		{
        case 0:break;
		case 1:Game(); break;
		case 2:Help(); break;
		case 3:About(); break;
		default:printf("输入错误！请重新输入！"); continue;
		}
	} while (chance != 0);
}
